﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Warehouse.Infrastructrue.Implenment
{
    public interface IBaseRepostity<T>  
    {
       /// <summary>
       /// 添加
       /// </summary>
       /// <param name="entity"></param>
       /// <returns></returns>
        Task<int> InsertAsync(T entity);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(T entity);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> DeleteAsync(T entity);
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        ISugarQueryable<T> GetAll();
        Task<IEnumerable<T>> QueryAsync(string sql, object parameters = null);
        Task<T> QueryFirstOrDefaultAsync(string sql, object parameters = null);
    }
}
